Imports System.Windows.Forms

Public Class frmSelectFields

    Private TableName As String

    Friend Sub New(_TableName As String, Caption As String, Prompt As String, Optional OptionText As String = "")
        InitializeComponent()
        TableName = _TableName
        Text = Caption
        lblPrompt.Text = Prompt
        lstFields.Items.Clear()
        For Each s As String In Project.DB.GetColumnList(TableName)
            With lstFields
                If s.ToUpper <> "RECID" Then .Items.Add(s)
            End With
        Next
        If OptionText = "" Then
            chkOption.Visible = False
        Else
            chkOption.Text = OptionText
            chkOption.Visible = True
        End If
    End Sub

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

End Class
